package com.dada.common;

import com.dangdang.ddframe.job.api.config.impl.SimpleJobConfiguration;
import com.dangdang.ddframe.job.plugin.job.type.simple.AbstractSimpleElasticJob;

/**
 * 作业配置工厂
 * Created by Jearton on 16/7/4.
 */
public class JobConfigurationFactory {

    /**
     * 创建简单作业配置.
     *
     * @param jobClass           作业实现类名称
     * @param shardingTotalCount 分片总数
     * @param cron               作业启动时间的cron表达式
     * @return 简单作业配置
     */
    public static SimpleJobConfiguration.SimpleJobConfigurationBuilder simpleJobConfigBuilder(
            final Class<? extends AbstractSimpleElasticJob> jobClass,
            final int shardingTotalCount,
            final String cron) {
        return new SimpleJobConfiguration.SimpleJobConfigurationBuilder(jobClass.getSimpleName(), jobClass, shardingTotalCount, cron);
    }
}